package com.qinggeng.project.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qinggeng.framework.aspectj.lang.annotation.Log;
import com.qinggeng.framework.aspectj.lang.enums.BusinessType;
import com.qinggeng.project.system.domain.PositionClassify;
import com.qinggeng.project.system.service.IPositionClassifyService;
import com.qinggeng.framework.web.controller.BaseController;
import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.common.utils.poi.ExcelUtil;
import com.qinggeng.framework.web.page.TableDataInfo;
/**
 * 职位分类Controller
 * 
 * @author smallfish
 * @date 2020-12-27
 */
@RestController
@RequestMapping("/system/positionClassify")
public class PositionClassifyController extends BaseController
{
    @Autowired
    private IPositionClassifyService positionClassifyService;

    /**
     * 查询职位分类列表
     */
    @PreAuthorize("@ss.hasPermi('system:positionClassify:list')")
    @GetMapping("/list")
    public TableDataInfo list(PositionClassify positionClassify)
    {
        startPage();
        List<PositionClassify> list = positionClassifyService.selectPositionClassifyList(positionClassify);
        return getDataTable(list);
    }

    /**
     * 导出职位分类列表
     */
    @PreAuthorize("@ss.hasPermi('system:positionClassify:export')")
    @Log(title = "职位分类", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(PositionClassify positionClassify)
    {
        List<PositionClassify> list = positionClassifyService.selectPositionClassifyList(positionClassify);
        ExcelUtil<PositionClassify> util = new ExcelUtil<PositionClassify>(PositionClassify.class);
        return util.exportExcel(list, "positionClassify");
    }

    /**
     * 获取职位分类详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:positionClassify:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(positionClassifyService.selectPositionClassifyById(id));
    }

    /**
     * 新增职位分类
     */
    @PreAuthorize("@ss.hasPermi('system:positionClassify:add')")
    @Log(title = "职位分类", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PositionClassify positionClassify)
    {
        return toAjax(positionClassifyService.insertPositionClassify(positionClassify));
    }

    /**
     * 修改职位分类
     */
    @PreAuthorize("@ss.hasPermi('system:positionClassify:edit')")
    @Log(title = "职位分类", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PositionClassify positionClassify)
    {
        return toAjax(positionClassifyService.updatePositionClassify(positionClassify));
    }

    /**
     * 删除职位分类
     */
    @PreAuthorize("@ss.hasPermi('system:positionClassify:remove')")
    @Log(title = "职位分类", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(positionClassifyService.deletePositionClassifyByIds(ids));
    }
}
